<?php

use admin\widgets\AdminUploadWidget;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;

/* @var $model app\models\Banner */
?>

<div class="banner-form">
    <?php $form = ActiveForm::begin([
        'id' => 'Banner',
/*        'options' => ['class' => 'form-horizontal'],
        'fieldConfig' => [
            'template' => "{label}\n<div class=\"col-sm-8 col-md-9\">{input}\n{error}</div>",
            'labelOptions' => ['class' => 'col-sm-4 col-md-3 control-label']
        ]*/
    ]); ?>

    <?= $form->field($model, 'title')->textInput(['maxlength' => true]); ?>

    <?= $form->field($model, 'image')->widget(AdminUploadWidget::className(), [
        'uploadOptions' => [
            'url' => Url::to(['default/upload', 'not_compress' => 1])
        ]
    ]); ?>

    <?= $form->field($model, 'type')->dropDownList(\app\models\Banner::getTypeLabels()); ?>

    <?= $form->field($model, 'url')->textInput(); ?>


    <?= $form->field($model, 'sort')->textInput(); ?>

    <?= $form->field($model, 'status')->checkbox(); ?>

    <div class="form-group hide">
        <?= Html::submitButton('保存', ['class' => 'btn btn-full']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
